package thread;

public class SleepDemo2 {
    public static void main(String[] args) {
        Thread zhao = new Thread("赵轶博"){
            public void run(){
                System.out.println(getName()+"开始");
                try {
                    Thread.sleep(50000);
                } catch (InterruptedException e) {
                    System.out.println("打断");
                }
                System.out.println("结束");
            }
        };
        Thread huang = new Thread("黄宏"){
            public void run(){
                for (int i = 0; i < 5; i++) {
                    System.out.println(getName() + "大锤80小锤40");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
                zhao.interrupt();
            }
        };
        zhao.start();
        huang.start();
    }
}
